<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 私有成员
        class Person {
            #weight = '100kg'
            constructor(name) {
                this.name = name
                this.agse = 20
                
            }
            // 利用共有方法调用私有成员
            getWeight() {
                console.log('体重是', this.#weight)
            }
            getFn() {
                this.#fn()
            }
            #fn() {
                console.log('私有方法')
            }
        }

        let a = new Person('卡莎')
        a.getWeight()
        a.getFn()



    </script>
</body>

</html>